import spring from "@/res/spring.js"

//线性回归模型接口 /Model/useLinearModel
function useLinearModel() {
    return spring({
        url: '/Model/useLinearModel',
        method: 'get'
    })
}

//逻辑回归模型接口 /Model/useLogisticRegressionModel
function useLogisticRegressionModel() {
    return spring({
        url: '/Model/useLogisticRegressionModel',
        method: 'get'
    })
}

//文件上传接口 /File/upload
/*
* file
* fileName
* modelType
* fileType
* */
function fileUpload(param={}) {
    return spring({
        url: '/File/upload',
        method: 'post',
        data: param,
        headers: {'Content-Type':'multipart/form-data'}
    })
}

// 获得所有模型
function getAllModel() {
    return spring({
        url: '/File/selAllModel',
        method: 'POST'
    })
}

// 根据输入获得模型
function selModel(param){
    return spring({
        url: '/File/selModel',
        method: 'POST',
        data: param
    })
}

// 进行线性回归
function useLinearRegression(param) {
    return spring({
        url: '/Model/useLinearModel',
        method: 'POST',
        data: param
    })
}

// 进行逻辑回归
function useLogisticRegression(param) {
    return spring({
        url: '/Model/useLogisticRegressionModel',
        method: 'GET',
        data: param
    })
}
export {
    fileUpload, getAllModel, selModel, useLinearRegression
}
